package com.example.dockers.controller;

import com.example.dockers.bean.Student;
import com.example.dockers.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName StuController
 * @Description TODO
 * @Auth ying.xiao
 * @Date 2021/7/19
 * @Version 1.0.0
 */
@RestController
public class StuController {

    @Autowired
    private StudentService studentService;

    @PostMapping("/add")
    public void add(@RequestBody Student student){
        studentService.add(student);
    }
    @PostMapping("/del")
    public void delStu(@RequestBody Student student){
        studentService.delStu(student);
    }
    @PostMapping("/update")
    public void update(@RequestBody Student student){
        studentService.updateStu(student);
    }
    @GetMapping("/queryAll")
    public List<Student> queryAll(){
       return studentService.queryAll();
    }
}
